function prob = fsb_calculate_prob(n,r)

% FSB: Calculate the probability value from a correlation coefficient and the number of values used
%
% EXAMPLE:
% prob = fsb_calculate_prob(100,0.25)
%
% INPUT:
% n:            sample size
% r:            correlation coefficient
%
% OUTPUT:
% probability values
%
% CALLED BY:
% FSB.m
%
% Copyright 2010 MPI for Biological Cybernetics
% Author: Steffen Stoewer
% License:GNU GPL, no express or implied warranties
% 
% $Revision 1.0
%
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Tdist = r*sqrt((n-2)/(1-r*r));
prob = tcdf(Tdist,n-2);
prob = 1-prob;

end
